﻿using Dqs_DAL;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Dqs_BLL
{
	public class Admin_BLL
	{
		Admin_DAL admin_DAL = new Admin_DAL();
		public string GetAdminName(int id)
		{
			foreach (var temp in admin_DAL.QueryAdminInfo())
			{
				if (temp.Id == id)
				{
					return temp.FullName!;
				}
			}
			return "";
		}

		public AdminInfo IsLoginOfAdmin(string name, string pwd)
		{
			var result = admin_DAL.IsLoginOfAdmin(name, pwd);
			if (result == null)
			{
				return null;
			}
			return result;
		}


		public List<AdminInfo> GetAdmins()
		{
			return admin_DAL.QueryAdminInfo();
		}

		public bool InsertAdminInfo(AdminInfo adminInfo)
		{
			return admin_DAL.InsertAdminInfo(adminInfo);
		}

		public bool UpdateAdminInfoById(AdminInfo adminInfo)
		{
			return admin_DAL.UpdateAdminInfoById(adminInfo);
		}

		public bool DeleteAdminInfoById(int adminId)
		{
			return admin_DAL.DeleteAdminInfoById(adminId);
		}
	}
}
